Skip to content

Commit 53d6e3a

Browse files
committed
fix: send message to LID addressing_mode groups
1 parent fb1d21b commit 53d6e3a

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

src/Socket/groups.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ export const extractGroupMetadata = (result: BinaryNode) => {
339339
const memberAddMode = getBinaryNodeChildString(group, 'member_add_mode') === 'all_member_add'
340340
const metadata: GroupMetadata = {
341341
id: groupId,
342+
addressingMode: group.attrs.addressing_mode,
342343
subject: group.attrs.subject,
343344
subjectOwner: group.attrs.s_o,
344345
subjectTime: +group.attrs.s_t,

src/Socket/messages-send.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,13 @@ export const makeMessagesSocket = (config: SocketConfig) => {
406406
participantsList.push(...statusJidList)
407407
}
408408

409+
if(!isStatus) {
410+
additionalAttributes = {
411+
...additionalAttributes,
412+
addressing_mode: groupData?.addressingMode || 'pn'
413+
}
414+
}
415+
409416
const additionalDevices = await getUSyncDevices(participantsList, !!useUserDevicesCache, false)
410417
devices.push(...additionalDevices)
411418
}
@@ -429,7 +436,7 @@ export const makeMessagesSocket = (config: SocketConfig) => {
429436
const senderKeyJids: string[] = []
430437
// ensure a connection is established with every device
431438
for(const { user, device } of devices) {
432-
const jid = jidEncode(user, isLid ? 'lid' : 's.whatsapp.net', device)
439+
const jid = jidEncode(user, groupData?.addressingMode ? 'lid' : 's.whatsapp.net', device)
433440
if(!senderKeyMap[jid] || !!participant) {
434441
senderKeyJids.push(jid)
435442
// store that this person has had the sender keys sent to them

src/Types/GroupMetadata.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ export type RequestJoinMethod = 'invite_link' | 'linked_group_join' | 'non_admin
1010

1111
export interface GroupMetadata {
1212
id: string
13+
/** group uses 'lid' or 'pn' to send messages */
14+
addressingMode: string
1315
owner: string | undefined
1416
subject: string
1517
/** group subject owner */

0 commit comments

Comments
 (0)